<template>
	<view class="content">
		<view class="top-tab">
			<block v-for="(item, index) in tab_list" :key="index">
				<view @click="changeTab(item.id)" class="item" :class="item.id == tab_id?'active':'noactive'">
					<text>{{item.name}}</text>
					<view class="bottom-line" v-if="item.id == tab_id"></view>
				</view>
			</block>
		</view>
		<block v-for="(item, index) in 3" :key="index">
			<view class="my-bargining-list">
				<view class="mask" v-if="index == 2"></view>
				<image class="image-left" src="" mode=""></image>
				<view class="item-right">
					<text class="item-title">王者荣耀皮肤 白晶晶芈月</text>
					<view class="item-center">
						<view class="item-ready">
							<view class="item-ready-line" style="width: 70%;"></view>
						</view>
						<text class="item-ready-text">已砍40%</text>
						<text class="item-ready-text" v-if="index == 1">砍价成功</text>
					</view>
					<view class="item-bottom">
						<view class="bargining-btn btn-background1" v-if="index == 0" @click="goToBarInfo(2)">
							<text>继续砍价</text>
						</view>
						<view class="bargining-btn btn-background2" v-if="index ==1" @click="goToBarInfo(2)">
							<text>领取商品</text>
						</view>
						<view class=""v-if="index ==2" style="display: flex;align-items: center;">
							<view class="bargining-btn btn-background2"  @click="goToBarInfo(2)">
								<text>砍价失败</text>
							</view>
							<text class="out-time">砍价已过期</text>
						</view>
						
						<ucountdown
							v-if="index==0"
							:timestamp="86400" 
							:font-size="30" 
							separator-color="#111111" 
							bg-color="#7c7c7c"
							:show-days="false"
							color="#FFFFFF"
						></ucountdown>
					</view>
				</view>
			</view>
		</block>
		
	</view>
</template>

<script>
	import ucountdown from "@/uview-ui/components/u-count-down/u-count-down.vue"
	export default {
		components:{
			ucountdown
		},
		data() {
			return {
				tab_id:1,
				tab_list:[
					{
						id:1,
						name:"进行中",
					},
					{
						id:2,
						name:"砍价成功",
					},
					{
						id:3,
						name:"砍价失败",
					},
				]
			};
		},
		onShow() {
			
		},
		onLoad() {
			
		},
		methods:{
			changeTab(id){
				this.tab_id = id
			},
		}
	}
</script>

<style lang="scss">
	.my-bargining-list{
		display: flex;
		align-items: center;
		width: 690upx;
		background: #FFFFFF;
		border-radius: 20upx;
		box-sizing: border-box;
		padding: 20upx 30upx 20upx 20upx;
		margin-bottom: 30upx;
		position: relative;
		.mask{
			width: 100%;
			height: 100%;
			position: absolute;
			opacity: 0;
			left: 0;
			z-index: 33;
			background: #FFFFFF;
			opacity: 0.7;
		}
		.item-right{
			display: flex;
			flex-direction: column;
			.item-title{
				font-size: 30upx;
				color: #111111;
				margin-bottom: 29upx;
			}
			.item-bottom{
				display: flex;
				align-items: center;
				justify-content: space-between;
				.item-number-user{
					font-size: 28upx;
					color: #AEAEAE;
				}
				.btn-background1{
					background: #FBDDDC;
					color: #E9564F;
				}
				.btn-background2{
					background: #E9564F;
					color: #ffffff;
				}
				.bargining-btn{
					box-sizing: border-box;
					padding: 10upx 16upx;
					border-radius: 24upx;
					font-size: 30upx;
					font-weight: 400;
				}
				.out-time{
					font-size: 28upx;
					color: #E9564F;
					margin-left: 21upx;
				}
			}
			.item-center{
				display: flex;
				align-items: center;
				margin-bottom: 30upx;
				.item-ready{
					display: flex;
					align-items: center;
					width: 253upx;
					height: 10upx;
					background: #FBDDDC;
					border-radius: 5upx;
					.item-ready-line{
						height: 10upx;
						border-radius: 5upx;
						background: #E9564F;
					}
				}
				.item-ready-text{
					font-size: 28upx;
					color: #E9564F;
					margin-left: 35upx;
				}
			}
		}
		.image-left{
			width: 200upx;
			height: 192upx;
			border-radius: 10upx;
			margin-right: 30upx;
			background: #EBEBEB;
		}
	}
	.top-tab{
		display: flex;
		align-items: center;
		justify-content: space-around;
		width: 690upx;
		padding: 30upx 0;
		box-sizing: border-box;
		border-radius: 20upx;
		background: #FFFFFF;
		margin-bottom: 30upx;
		.item{
			display: flex;
			justify-content: center;
			position: relative;
			font-size: 30upx;
			.bottom-line{
				width: 74upx;
				height: 4upx;
				background: #E9564F;
				position: absolute;
				bottom: -30upx;
			}
		}
		.active{
			font-weight: bold;
			color: #E9564F;
		}
		.noactive{
			font-weight: 400;
			color: #111111;
		}
	}
	.content{
		display: flex;
		align-items: center;
		flex-direction: column;
		min-height: 100vh;
		width: 750upx;
		box-sizing: border-box;
		padding: 30upx;
		background: #F7F7F7;
	}
</style>
